package org.example.partten.factory.post;

import org.example.dao.dao.user.UUserDao;
import org.example.dao.dto.commom.UserInfo;
import org.example.dao.entity.user.UUser;
import org.example.partten.factory.UserInfoFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author 22449
 */
@Component
public class PostUserInfoFactory implements UserInfoFactory {

    @Resource
    private UUserDao uUserDao;

    @Override
    public UserInfo createUserInfo(String userId) {
        UUser user = uUserDao.selectById(userId);
        return new UserInfo.Builder()
                .userId(user.getId())
                .userIcon(user.getIcon())
                .userNickName(user.getNickName()).build();
    }

}
